<template>

  <div class="container">
  <i class="el-icon-s-fold" @click="collapse"></i>
  <el-breadcrumb separator="/">

    <el-breadcrumb-item :to="{ path: item.path}" v-for="(item, index) in breads" :key="index">{{item.meta.title}}</el-breadcrumb-item>

  </el-breadcrumb>
  </div>
</template>

<script>
import {mapState, mapMutations} from "vuex"

export default {
  name: "breadcrumb",
  data(){
    return {
      breads:[]
    }
  },
  computed:{
    ...mapState("user", ["Collapse"])
  },
  methods:{
    ...mapMutations("user", ["setCollapse"]),
    collapse(){
      this.setCollapse()

    }
  },

  watch:{
   $route(){
     this.breads = this.$route.matched
   }
  },
  created() {
  }


}
</script>

<style scoped lang="less">

@mainColor: #eaebec; //正确的
.container {
  height: 30px;
  width: 100%;
  display: flex;
  align-items: center;
  background: @mainColor; // @mainColor;
  i {
    line-height: 30px;
    font-size: 20px;
    cursor: pointer;
    padding-right: 20px;
  }
}

</style>